#ifndef ABSTRACTCONTROLLER_H
#define ABSTRACTCONTROLLER_H

#include <QSharedPointer>
#include "Myobject.h"
#include "Abstractmodel.h"

template<typename T>class AbstractController : public MyObject
    {
        typedef QSharedPointer<AbstractModel<T> > AbstractModelPtr;
    protected:
        AbstractModelPtr m_ptrModel;
    public:
        AbstractController(AbstractModelPtr & ptrModel);
        virtual ~AbstractController();
        void setData(T data);
        void reset();
    };

template<typename T> AbstractController<T>::AbstractController(AbstractModelPtr & ptrModel):MyObject(), m_ptrModel(AbstractModelPtr(ptrModel))
    {
    print()<<"AbstractController construction"<<std::endl;
    }

template<typename T> AbstractController<T>::~AbstractController()
    {
    print()<<"AbstractController destruction"<<std::endl;
    }

template<typename T> void AbstractController<T>::reset()
    {
    m_ptrModel.data()->reset();
    }

template<typename T> void AbstractController<T>::setData(T data)
    {
    m_ptrModel.data()->setData(data);
    }
#endif // ABSTRACTCONTROLLER_H
